package com.hzhq.contract.repo;

import com.hzhq.contract.bean.entity.Depart;
import org.bson.types.ObjectId;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

/**
 * @author hzhq
 * @create 2021/4/9 8:01 下午
 * @email hzhq1255@163.com
 */
@Repository
public interface DepartRepository extends MongoRepository<Depart, ObjectId> {

    Optional<Depart> findByDepartNameAndDeleted(String departName, Integer deleted);

    Optional<Depart> findByDepartIdAndAndDeleted(ObjectId departId, Integer deleted);

    List<Depart> findByDeleted(Integer deleted);

    Page<Depart> findByDeleted(Integer deleted, Pageable pageable);

    Optional<Depart> findByDepartIdAndDeleted(String departId, Integer notDeleted);

    List<Depart> findByDepartIdInAndDeleted(List<ObjectId> departIds , Integer notDeleted);
}
